<?php
class dt_inventario extends toba_datos_tabla
{
	function get_descripciones()
	{
		$sql = "SELECT id_terminal, num_serie FROM inventario ORDER BY num_serie";
		return toba::db('fce')->consultar($sql);
	}

	function get_listado()
	{
		$sql = "SELECT
			t_i.id_terminal,
			t_i.cargo,
			t_i.num_inventario,
			t_i.num_serie,
			tipo.descripcion as tipo,
			t_t.detalle as detalle
		FROM
			inventario as t_i LEFT OUTER JOIN terminal as t_t ON (t_i.id_terminal = t_t.id_terminal)
			LEFT OUTER JOIN tipo ON (tipo.id_tipo IN (SELECT t_t.id_tipo FROM terminal WHERE t_t.id_terminal = t_i.id_terminal))
		ORDER BY id_terminal";

		return toba::db('fce')->consultar($sql);
	}

}
?>